// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

pub mod os_login_service {
    use crate::Result;

    /// A builder for [OsLoginService][crate::client::OsLoginService].
    ///
    /// ```
    /// # tokio_test::block_on(async {
    /// # use google_cloud_oslogin_v1::*;
    /// # use builder::os_login_service::ClientBuilder;
    /// # use client::OsLoginService;
    /// let builder : ClientBuilder = OsLoginService::builder();
    /// let client = builder
    ///     .with_endpoint("https://oslogin.googleapis.com")
    ///     .build().await?;
    /// # gax::client_builder::Result::<()>::Ok(()) });
    /// ```
    pub type ClientBuilder =
        gax::client_builder::ClientBuilder<client::Factory, gaxi::options::Credentials>;

    pub(crate) mod client {
        use super::super::super::client::OsLoginService;
        pub struct Factory;
        impl gax::client_builder::internal::ClientFactory for Factory {
            type Client = OsLoginService;
            type Credentials = gaxi::options::Credentials;
            async fn build(
                self,
                config: gaxi::options::ClientConfig,
            ) -> gax::client_builder::Result<Self::Client> {
                Self::Client::new(config).await
            }
        }
    }

    /// Common implementation for [crate::client::OsLoginService] request builders.
    #[derive(Clone, Debug)]
    pub(crate) struct RequestBuilder<R: std::default::Default> {
        stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        request: R,
        options: gax::options::RequestOptions,
    }

    impl<R> RequestBuilder<R>
    where
        R: std::default::Default,
    {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self {
                stub,
                request: R::default(),
                options: gax::options::RequestOptions::default(),
            }
        }
    }

    /// The request builder for [OsLoginService::create_ssh_public_key][crate::client::OsLoginService::create_ssh_public_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::CreateSshPublicKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> CreateSshPublicKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct CreateSshPublicKey(RequestBuilder<crate::model::CreateSshPublicKeyRequest>);

    impl CreateSshPublicKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::CreateSshPublicKeyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<oslogin_common::model::SshPublicKey> {
            (*self.0.stub)
                .create_ssh_public_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::CreateSshPublicKeyRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [ssh_public_key][crate::model::CreateSshPublicKeyRequest::ssh_public_key].
        ///
        /// This is a **required** field for requests.
        pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [ssh_public_key][crate::model::CreateSshPublicKeyRequest::ssh_public_key].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for CreateSshPublicKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::delete_posix_account][crate::client::OsLoginService::delete_posix_account] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::DeletePosixAccount;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeletePosixAccount {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeletePosixAccount(RequestBuilder<crate::model::DeletePosixAccountRequest>);

    impl DeletePosixAccount {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeletePosixAccountRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_posix_account(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeletePosixAccountRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeletePosixAccount {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::delete_ssh_public_key][crate::client::OsLoginService::delete_ssh_public_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::DeleteSshPublicKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> DeleteSshPublicKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct DeleteSshPublicKey(RequestBuilder<crate::model::DeleteSshPublicKeyRequest>);

    impl DeleteSshPublicKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::DeleteSshPublicKeyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<()> {
            (*self.0.stub)
                .delete_ssh_public_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::DeleteSshPublicKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for DeleteSshPublicKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::get_login_profile][crate::client::OsLoginService::get_login_profile] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::GetLoginProfile;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetLoginProfile {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetLoginProfile(RequestBuilder<crate::model::GetLoginProfileRequest>);

    impl GetLoginProfile {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetLoginProfileRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::LoginProfile> {
            (*self.0.stub)
                .get_login_profile(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetLoginProfileRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [project_id][crate::model::GetLoginProfileRequest::project_id].
        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.project_id = v.into();
            self
        }

        /// Sets the value of [system_id][crate::model::GetLoginProfileRequest::system_id].
        pub fn set_system_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.system_id = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetLoginProfile {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::get_ssh_public_key][crate::client::OsLoginService::get_ssh_public_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::GetSshPublicKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> GetSshPublicKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct GetSshPublicKey(RequestBuilder<crate::model::GetSshPublicKeyRequest>);

    impl GetSshPublicKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::GetSshPublicKeyRequest>>(mut self, v: V) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<oslogin_common::model::SshPublicKey> {
            (*self.0.stub)
                .get_ssh_public_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::GetSshPublicKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for GetSshPublicKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::import_ssh_public_key][crate::client::OsLoginService::import_ssh_public_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::ImportSshPublicKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> ImportSshPublicKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct ImportSshPublicKey(RequestBuilder<crate::model::ImportSshPublicKeyRequest>);

    impl ImportSshPublicKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::ImportSshPublicKeyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<crate::model::ImportSshPublicKeyResponse> {
            (*self.0.stub)
                .import_ssh_public_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [parent][crate::model::ImportSshPublicKeyRequest::parent].
        ///
        /// This is a **required** field for requests.
        pub fn set_parent<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.parent = v.into();
            self
        }

        /// Sets the value of [ssh_public_key][crate::model::ImportSshPublicKeyRequest::ssh_public_key].
        pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [ssh_public_key][crate::model::ImportSshPublicKeyRequest::ssh_public_key].
        pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = v.map(|x| x.into());
            self
        }

        /// Sets the value of [project_id][crate::model::ImportSshPublicKeyRequest::project_id].
        pub fn set_project_id<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.project_id = v.into();
            self
        }

        /// Sets the value of [regions][crate::model::ImportSshPublicKeyRequest::regions].
        pub fn set_regions<T, V>(mut self, v: T) -> Self
        where
            T: std::iter::IntoIterator<Item = V>,
            V: std::convert::Into<std::string::String>,
        {
            use std::iter::Iterator;
            self.0.request.regions = v.into_iter().map(|i| i.into()).collect();
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for ImportSshPublicKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }

    /// The request builder for [OsLoginService::update_ssh_public_key][crate::client::OsLoginService::update_ssh_public_key] calls.
    ///
    /// # Example
    /// ```no_run
    /// # use google_cloud_oslogin_v1::builder;
    /// use builder::os_login_service::UpdateSshPublicKey;
    /// # tokio_test::block_on(async {
    ///
    /// let builder = prepare_request_builder();
    /// let response = builder.send().await?;
    /// # gax::Result::<()>::Ok(()) });
    ///
    /// fn prepare_request_builder() -> UpdateSshPublicKey {
    ///   # panic!();
    ///   // ... details omitted ...
    /// }
    /// ```
    #[derive(Clone, Debug)]
    pub struct UpdateSshPublicKey(RequestBuilder<crate::model::UpdateSshPublicKeyRequest>);

    impl UpdateSshPublicKey {
        pub(crate) fn new(
            stub: std::sync::Arc<dyn super::super::stub::dynamic::OsLoginService>,
        ) -> Self {
            Self(RequestBuilder::new(stub))
        }

        /// Sets the full request, replacing any prior values.
        pub fn with_request<V: Into<crate::model::UpdateSshPublicKeyRequest>>(
            mut self,
            v: V,
        ) -> Self {
            self.0.request = v.into();
            self
        }

        /// Sets all the options, replacing any prior values.
        pub fn with_options<V: Into<gax::options::RequestOptions>>(mut self, v: V) -> Self {
            self.0.options = v.into();
            self
        }

        /// Sends the request.
        pub async fn send(self) -> Result<oslogin_common::model::SshPublicKey> {
            (*self.0.stub)
                .update_ssh_public_key(self.0.request, self.0.options)
                .await
                .map(gax::response::Response::into_body)
        }

        /// Sets the value of [name][crate::model::UpdateSshPublicKeyRequest::name].
        ///
        /// This is a **required** field for requests.
        pub fn set_name<T: Into<std::string::String>>(mut self, v: T) -> Self {
            self.0.request.name = v.into();
            self
        }

        /// Sets the value of [ssh_public_key][crate::model::UpdateSshPublicKeyRequest::ssh_public_key].
        ///
        /// This is a **required** field for requests.
        pub fn set_ssh_public_key<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [ssh_public_key][crate::model::UpdateSshPublicKeyRequest::ssh_public_key].
        ///
        /// This is a **required** field for requests.
        pub fn set_or_clear_ssh_public_key<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<oslogin_common::model::SshPublicKey>,
        {
            self.0.request.ssh_public_key = v.map(|x| x.into());
            self
        }

        /// Sets the value of [update_mask][crate::model::UpdateSshPublicKeyRequest::update_mask].
        pub fn set_update_mask<T>(mut self, v: T) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = std::option::Option::Some(v.into());
            self
        }

        /// Sets or clears the value of [update_mask][crate::model::UpdateSshPublicKeyRequest::update_mask].
        pub fn set_or_clear_update_mask<T>(mut self, v: std::option::Option<T>) -> Self
        where
            T: std::convert::Into<wkt::FieldMask>,
        {
            self.0.request.update_mask = v.map(|x| x.into());
            self
        }
    }

    #[doc(hidden)]
    impl gax::options::internal::RequestBuilder for UpdateSshPublicKey {
        fn request_options(&mut self) -> &mut gax::options::RequestOptions {
            &mut self.0.options
        }
    }
}
